package com.eventapp.service;

import com.eventapp.model.Event;
import com.eventapp.model.EventPrivate;
import com.eventapp.model.EventPublic;
import com.eventapp.model.User;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;

import javax.jws.WebService;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import java.io.IOException;
import java.util.List;

/**
 * Web Service interface so hierarchy of Generic Manager isn't carried through.
 */
@WebService
@Path("/events")
public interface EventService {
    /**
     * Retrieves a Event by Id.  An exception is thrown if event not found
     *
     * @param eventId the identifier for the user
     * @return Event
     */
    @GET
    @Path("get/{id}")
    public Event getEvent(@PathParam("id") String eventId);

    /**
     * Retrieves a list of all public events.
     *
     * @return List
     */
    
    @GET
    @Path("get/publicEvents")
    public List<EventPublic> getPublicEvents();

    /**
     * Saves a user's information
     *
     * @param user the user's information
     * @return updated user
     * @throws IOException 
     * @throws JsonMappingException 
     * @throws JsonParseException 
     * @throws UserExistsException thrown when user already exists
     */
    @POST
    @Path("post/createPublicEvent")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
	public Response createEventPublic(String json) throws EventExistsException, JsonParseException, JsonMappingException, IOException;

    @POST
    @Path("post/createPrivateEvent")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public Response createEventPrivate(String json) throws EventExistsException, JsonParseException, JsonMappingException, IOException;
}
